package com.example.demofin.serveice.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demofin.mapper.DetailMapper;
import com.example.demofin.pojo.Detail;
import com.example.demofin.serveice.IDetailService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class DetailService implements IDetailService {

    @Resource
    private DetailMapper detailMapper;


    @Override
    public IPage<Detail> selDetail(Integer pageNum, Integer pageSize, Map map) {
        if (map.get("kehuzhao").equals("")) {
            throw new IllegalStateException("ERROR：客户账号不能为空！");
        }
        IPage<Detail> config = new Page<>(pageNum, pageSize);
        IPage<Detail> lidetail;
        try {
            lidetail=this.detailMapper.sel_detail_byparams(config, map);
        } catch (Exception e) {
            throw new IllegalStateException("ERROR：查询失败，请检查输入！");
        }
        return lidetail;
    }

}
